home *** CD-ROM | disk | FTP | other *** search
/ Enter 2005 October / enter-2005-10.iso / files / jedit42install.exe / {app} / macros / Files / Close_All_Except_Active.bsh < prev    next >
Encoding:
Text File  |  2004-08-29  |  1.6 KB  |  58 lines

  1. /*
  2.  * Close_All_Except_Active.bsh - a BeanShell macro script for the
  3.  * jEdit text editor - Closes all except the current active buffer
  4.  * Copyright (C) 2001 John Gellene
  5.  * jgellene@nyc.rr.com
  6.  * http://community.jedit.org
  7.  *
  8.  * This program is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU General Public License
  10.  * as published by the Free Software Foundation; either version 2
  11.  * of the License, or any later version.
  12.  *
  13.  * This program is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  * GNU General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU General Public License
  19.  * along with this program; if not, write to the Free Software
  20.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  21.  *
  22.  * $Id: Close_All_Except_Active.bsh,v 1.2 2001/11/06 17:15:01 jgellene Exp $
  23.  *
  24.  * Checked for jEdit 4.0 API
  25.  *
  26.  */
  27.  
  28. void closeBuffersExceptActive()
  29. {
  30.     buffers = jEdit.getBuffers();
  31.     for(i = 0; i < buffers.length; ++i)
  32.     {
  33.         if(buffers[i] != buffer)
  34.             jEdit.closeBuffer(view, buffers[i]);
  35.     }
  36. }
  37.  
  38. closeBuffersExceptActive();
  39.  
  40. /*
  41.     Macro index data (in DocBook format)
  42.  
  43. <listitem>
  44.     <para><filename>Close_Except_Active.bsh</filename></para>
  45.     <abstract><para>
  46.         Closes all files except the current buffer.
  47.     </para></abstract>
  48.     <para>
  49.         Prompts the user to save any buffer containing unsaved changes.
  50.     </para>
  51. </listitem>
  52.  
  53. */
  54.  
  55.  
  56. // end Close_Except_Active.bsh
  57.  
  58.